package com.suixinsanren.design.compound.demo02;

public class DuckCall implements QuackAble {

    private Observable observable;

    public DuckCall() {
        new Observable(this);
    }

    @Override
    public void quack() {
        System.out.println("胯胯胯");
    }

    @Override
    public void addObserver(Observer observer) {
        observable.addObserver(observer);
        observable.notifyObserver();
    }

    @Override
    public void notifyObserver() {
        observable.notifyObserver();
    }

    @Override
    public String toString() {
        return "鸭声模拟器";
    }
}
